package info.fqtech.springcloud.admin.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author YASSER   作者 E-mail:   450153554@qq.com
 * @date: 2018-12-06 14:50
 * @version: 1.0.0
 * @description: <文件描述>
 * @modified: <文件修改说明>
 */
@Slf4j
@RestController
public class HelloController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/sayHello")
    public String sayHello(String name) {
        log.info("这个是admin项目的sayHello:{}", name);
        return name;
    }

    @RequestMapping("/sayHello2")
    public String sayHello2(String name) {
        String response = restTemplate.getForObject("http://eureka-client/client/sayHello?name=" + name, String.class);
        log.info("response:{}", response);
        return response;
    }

    @RequestMapping("/sayHello3")
    public String sayHello3(String name) {
        String response = restTemplate.getForObject("http://EUREKA-CLIENT/client/sayHello?name=" + name, String.class);
        log.info("response:{}", response);
        return response;
    }

}
